package edu.kjxy.demo0315;

import java.util.Scanner;

public class demo02 {

	public static void main(String[] args) {
		String NAME = "zhangs";
		String PASS = "123456";
		
		Scanner in = new Scanner(System.in);
		
		for(int i = 1; i <= 5; i++) {
			System.out.println("请输入用户名和密码：");
			String name = in.next();
			String pass = in.next();
			
			if(name.equals(NAME) && pass.equals(PASS)) {
				System.out.println("登录成功");
				break;
			}
			
			if(i < 5) {
				System.out.println("您还有" + (5 - i) + "次机会");
			}
			else {
				System.out.println("错误上限已到，程序结束");
			}
		}
		in.close();
	}
}
